home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / hf^k-5.dms / in.adf / Fastlib.Lha / Include / stormamigainline.h < prev   
Encoding:
C/C++ Source or Header  |  1996-12-14  |  6.1 KB  |  297 lines

  1. #ifndef  STORMAMIGAINLINE_H
  2. #define  STORMAMIGAINLINE_H
  3.  
  4. /*
  5. **   $VER: stormamigainline.h 42.04 (12.12.1996)
  6. **
  7. **          Copyright © 1996 by COMPIUTECK
  8. **            written by Matthias Henze
  9. **               All Rights Reserved
  10. */
  11.  
  12. #ifndef  _INCLUDE_STDIO_H
  13. #include <stdio.h>
  14. #endif
  15.  
  16. #ifndef  _INCLUDE_STDLIB_H
  17. #include <stdlib.h>
  18. #endif
  19.  
  20. #ifndef  _INCLUDE_SIGNAL_H
  21. #include <signal.h>
  22. #endif
  23.  
  24. #ifndef _INCLUDE_TIME_H
  25. #include <time.h>
  26. #endif
  27.  
  28. #ifndef _INCLUDE_ERRNO_H
  29. #include <errno.h>
  30. #endif
  31.  
  32. #ifndef _INCLUDE_FILEDEFS_H
  33. #include <filedefs.h>
  34. #endif
  35.  
  36. #ifndef HARDWARE_INTBITS_H
  37. #include <hardware/intbits.h>
  38. #endif
  39.  
  40. #ifndef INTUITION_INTUITION_H
  41. #include <intuition/intuition.h>
  42. #endif
  43.  
  44. #ifndef GRAPHICS_RASTPORT_H
  45. #include <graphics/rastport.h>
  46. #endif
  47.  
  48. #ifndef _INCLUDE_PRAGMA_EXEC_LIB_H
  49. #include <pragma/exec_lib.h>
  50. #endif
  51.  
  52. #ifndef _INCLUDE_PRAGMA_DOS_LIB_H
  53. #include <pragma/dos_lib.h>
  54. #endif
  55.  
  56. #ifndef _INCLUDE_PRAGMA_GRAPHICS_LIB_H
  57. #include <pragma/graphics_lib.h>
  58. #endif
  59.  
  60. #ifndef  CLIB_ALIB_PROTOS_H
  61. #include <clib/alib_protos.h>
  62. #endif
  63.  
  64. #ifndef  STORMAMIGA_H
  65. #include <stormamiga.h>
  66. #endif
  67.  
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71.  
  72.  
  73. #define lint             long int
  74. #define llint            long long int
  75. #define uint             unsigned int
  76. #define ulint            unsigned long int
  77. #define ullint           unsigned long long int
  78. #define llong            long long
  79. #define ulong            unsigned long
  80. #define ullong           unsigned long long
  81.  
  82.  
  83. /*----- stdio-functions -----*/
  84.  
  85. #define getc             fgetc
  86. #define putc             fputc
  87.  
  88. __inline int fgetc       (FILE *f)
  89. { return (*f -> getch)   (f); }
  90.  
  91. __inline int getchar     (void)
  92. { return fgetc           (stdin); }
  93.  
  94. __inline int ungetc      (int ch, FILE *f)
  95. { return (*f -> ungetch) (f, ch); }
  96.  
  97. __inline int fputc       (int ch, FILE *f)
  98. { return (*f->putch)     (f, ch); }
  99.  
  100. __inline int putchar     (int ch)
  101. { return fputc           (ch, stdout); }
  102.  
  103. __inline int feof        (FILE *f)
  104. { return (*f -> eof)     (f); }
  105.  
  106. __inline int ferror      (FILE *f)
  107. { return f -> error; }
  108.  
  109. __inline void clearerr   (FILE *f)
  110. { f -> error = 0; }
  111.  
  112. __inline void perror     (const char *s)
  113. { PrintFault             (errno, (STRPTR) s); }
  114.  
  115. __inline int remove      (const char *s)
  116. { return DeleteFile      ((STRPTR) s) == 0; }
  117.  
  118. __inline int rename      (const char *s, const char *ns)
  119. { return Rename          ((STRPTR) s,(STRPTR) ns) == 0; }
  120.  
  121. __inline void setbuf     (FILE *f, char *buffer)
  122. { setvbuf                (f, buffer, _IOFBF, BUFSIZ); }
  123.  
  124. __inline int vprintf     (const char *format, va_list vl)
  125. { return vfprintf        (stdout, format, vl) }
  126.  
  127.  
  128. /*----- Nonstandard-stdio-functions -----*/
  129.  
  130. __inline int vprintf_    (const char *format, va_list vl)
  131. { return vfprintf_       (stdout, format, vl) }
  132.  
  133. __inline int vscanf      (const char *format, va_list vl)
  134. { return vfscanf         (stdin, format, vl); }
  135.  
  136. __inline int vscanf_     (const char *format, va_list vl)
  137. { return vfscanf_        (stdin, format, vl); }
  138.  
  139.  
  140. /*----- GCC-Nonstandard-stdio-functions -----*/
  141.  
  142. __inline void setbuffer  (FILE *f, char *buffer, int size)
  143. { setvbuf                (f, buffer, _IOFBF, size); }
  144.  
  145. __inline int setlinebuf  (FILE *f)
  146. {
  147.   (void) setvbuf         (f, (char *) NULL, _IOLBF, (size_t) 0);
  148.   return 0;
  149. }
  150.  
  151.  
  152. /*----- stdlib-functions -----*/
  153.  
  154. #define atoi             atol
  155.  
  156. __inline long atol       (const char *s)
  157. { return (long) strtol   (s, NULL, 10); }
  158.  
  159. __inline long long atoll (const char *s)
  160. { return strtoll         (s, NULL, 10); }
  161.  
  162. __inline double atof     (const char *s)
  163. { double x;
  164.   dsscanf                (s, "%lf", &x);
  165.   return x;
  166. }
  167.  
  168. __inline void abort      (void)
  169. { raise                  (SIGABRT); }
  170.  
  171.  
  172. /*----- time-functions -----*/
  173.  
  174. __inline struct tm *localtime (const time_t *tp)
  175. { return gmtime          (tp); }
  176.  
  177. #ifndef STORMAMIGA_DEUTSCH
  178.  
  179. __inline char *ctime     (const time_t *t)
  180. { return asctime         (localtime (t)); }
  181. #endif
  182.  
  183. __inline double difftime (time_t t1, time_t t2)
  184. { return t1 - t2 }
  185.  
  186.  
  187. /*----- Nonstandard-time-functions -----*/
  188.  
  189. #ifdef STORMAMIGA_DEUTSCH
  190.  
  191. #define ctime            ctime_d
  192. #endif
  193.  
  194. __inline char *ctime_d   (const time_t *t)
  195. { return asctime_d       (localtime (t)); }
  196.  
  197.  
  198. /*----- amiga.lib-functions -----*/
  199.  
  200. #define DeleteTask       RemTask
  201.  
  202. __inline void RemTOF     (struct Isrvstr *intr)
  203. { RemIntServer           (INTB_VERTB, (struct Interrupt *) intr); }
  204.  
  205. __inline struct IOStdReq *CreateStdIO (struct MsgPort *port)
  206. { return (struct IOStdReq *) CreateExtIO (port, sizeof (struct IOStdReq)); }
  207.  
  208. __inline void waitbeam   (long pos)
  209. { do {} while (pos > VBeamPos ()); }
  210.  
  211. __inline void NewList    (struct List *list)
  212. {
  213.    long *p;
  214.    list -> lh_TailPred = (struct Node*) list;
  215.    list = (struct List *)((char *) list + sizeof (LONG));
  216.    *(long *) list = 0;
  217.    p = (long *) list;
  218.    *-- p = (long) list;
  219. }
  220.  
  221.  
  222. /*----- Amiga-functions -----*/
  223.  
  224. #ifdef STORMAMIGA_REGISTER
  225.  
  226. #undef Move
  227. #undef GetAPen
  228. #undef GetBPen
  229. #endif
  230.  
  231. #define Move Move_
  232. #define GetAPen GetAPen_
  233. #define GetBPen GetBPen_
  234.  
  235. __inline void Move_ (struct RastPort * rp, long x, long y)
  236. {
  237.     rp -> cp_x = x;
  238.     rp -> cp_y = y;
  239. }
  240.  
  241. __inline ulong GSetAPen_ (struct RastPort * rp)
  242. { return rp -> FgPen; }
  243.  
  244. __inline ulong  GetBPen_ (struct RastPort * rp)
  245. { return rp -> BgPen; }
  246.  
  247.  
  248. /*----- Special-functions -----*/
  249.  
  250. #ifdef STORMAMIGA_REGISTER
  251.  
  252. #undef muls
  253. #undef mulu
  254. #undef max_Width
  255. #undef max_Height
  256. #endif
  257.  
  258. __inline long  muls      (long arg1, long arg2)
  259. { return arg1 * arg2 }
  260.  
  261. __inline ulong mulu      (ulong arg1, ulong arg2)
  262. { return arg1 * arg2 }
  263.  
  264. __inline int max_Width (struct  Window  *window)
  265. { return (window -> Width - window -> BorderLeft - window -> BorderRight); }
  266.  
  267. __inline int max_Height (struct Window *window)
  268. { return (window -> Height - window -> BorderTop - window -> BorderBottom); }
  269.  
  270.  
  271. /*----- Alpha-functions -----*/
  272.  
  273. #ifdef STORMAMIGA_ALPHA
  274.  
  275. #ifdef STORMAMIGA_REGISTER
  276.  
  277. #undef SetAPen
  278. #undef SetBPen
  279. #endif
  280.  
  281. #define SetAPen SetAPen_
  282. #define SetBPen SetBPen_
  283.  
  284. __inline void SetAPen_ (struct RastPort * rp, ulong c)
  285. { rp -> FgPen = c; }
  286.  
  287. __inline void SetBPen_ (struct RastPort * rp, ulong c)
  288. { rp -> BgPen = c; }
  289.  
  290. #endif
  291.  
  292. #ifdef __cplusplus
  293. }
  294. #endif
  295.  
  296. #endif   /* STORMAMIGAINLINE_H */
  297.